package net.jueb.majong.voice.util;

import java.util.HashSet;
import java.util.Properties;
import java.util.Set;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.jueb.util4j.common.game.env.Environment;

public class Config {
	
	private static Logger log=LoggerFactory.getLogger(Config.class);
	public static final Environment env=Environment.getInstance();
	public static final Set<String> ACCESS_ORIGIN_LIST=new HashSet<String>();//跨域主机白名单
	
	static{
		load();
	}
	
	/**
	 * 加载配置文件
	 */
	public static void load()
	{
		Properties pp = new Properties();
		try {
			pp.load(Config.class.getClassLoader().getResourceAsStream("conf/config.properties"));
			//跨域允许列表
			String[] ORIGIN_ACCESS_LIST_=pp.getProperty("ACCESS_ORIGIN_LIST","").split(",");
			for(String web:ORIGIN_ACCESS_LIST_)
			{
				ACCESS_ORIGIN_LIST.add(web);
			}
		} catch (Exception e) {
			log.error(e.getMessage(),e);
		}
	}
}
